import axios from 'axios';

import { LIST_DATA } from './actionTypes';

const userList = (list) => ({
    list,
    type: LIST_DATA
});

export const getUserList = (type) => {
    const getUrl = `/user/list?type=${type}`;
    return (dispatch) => {
        axios.get(getUrl).then((res) => {
            if (res.data.code===0) {
                dispatch(userList(res.data.data))
            }
        }).catch();
    }
}